import 'package:flutter/material.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_button.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';
import '../models/hire_empty_model.dart';

class HireEmptyItem extends StatelessWidget {
  final HireEmptyModel itemModel;
  final Function()? rentAction;
  const HireEmptyItem({super.key, required this.itemModel, this.rentAction});

  @override
  Widget build(BuildContext context) {
    return MGCard(
      margin: EdgeInsets.all(12),
      children: [
        Container(
          margin: EdgeInsets.only(bottom: 15),
          width: double.infinity,
          child: Text(
            itemModel.deviceName ?? "",
            style: TextStyle(
              color: MGColors.text1Color,
              fontSize: MGFont.textFont1,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        Container(
          margin: EdgeInsets.only(bottom: 15),
          width: double.infinity,
          child: Text(
            itemModel.disPlayNo ?? "",
            style: TextStyle(
              color: MGColors.text1Color,
              fontSize: MGFont.textFont1,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        Flex(direction: Axis.horizontal, children: [
          Expanded(
              flex: 1,
              child: Container(
                decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(4)),
                padding: EdgeInsets.only(top: 10, bottom: 10),
                child: Column(
                  children: [
                    Image.asset(
                      (itemModel.smallNo != null && itemModel.smallNo! > 0) ? MGImage.image("public_small") : MGImage.image("public_small_hui"),
                      width: 25,
                    ),
                    SizedBox(height: 5),
                    Text(
                      itemModel.smallNo.toString(),
                      style: TextStyle(color: MGColors.text1Color, fontSize: MGFont.textFont2),
                    )
                  ],
                ),
              )),
          SizedBox(width: 16),
          Expanded(
              flex: 1,
              child: Container(
                decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(4)),
                padding: EdgeInsets.only(top: 10, bottom: 10),
                child: Column(
                  children: [
                    Image.asset(
                      (itemModel.mediumNo != null && itemModel.mediumNo! > 0) ? MGImage.image("public_middle") : MGImage.image("public_middle_hui"),
                      width: 25,
                    ),
                    SizedBox(height: 5),
                    Text(
                      itemModel.mediumNo.toString(),
                      style: TextStyle(
                        color: MGColors.text1Color,
                        fontSize: MGFont.textFont2,
                      ),
                    )
                  ],
                ),
              )),
          SizedBox(width: 16),
          Expanded(
              flex: 1,
              child: Container(
                decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(4)),
                padding: EdgeInsets.only(top: 10, bottom: 10),
                child: Column(
                  children: [
                    Image.asset(
                      (itemModel.largeNo != null && itemModel.largeNo! > 0) ? MGImage.image("public_big") : MGImage.image("public_big_hui"),
                      width: 25,
                    ),
                    SizedBox(height: 5),
                    Text(
                      itemModel.largeNo.toString(),
                      style: TextStyle(
                        color: MGColors.text1Color,
                        fontSize: MGFont.textFont2,
                      ),
                    )
                  ],
                ),
              ))
        ]),
        SizedBox(height: 10),
        Row(
          children: [
            Container(
              width: 120,
              child: MGButton(
                title: "去租用",
                buttonAction: rentAction,
              ),
            )
          ],
          mainAxisAlignment: MainAxisAlignment.end,
        ),
      ],
    );
  }
}
